<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<button @click="add">添加</button>
			<p v-for="stu in stus">{{stu.name}} <input type="text"></p>
		</div>
		<script type="text/javascript">
			new Vue({
				el: '#app',
				data: {
					stus: [{
						id: 1,
						name: "张三",
						age: 20
					}, {
						id: 2,
						name: "李四",
						age: 30
					}, {
						id: 3,
						name: "王五",
						age: 50
					}]
				},
				methods: {
					add() {
						//vue对象
						// console.log(this)
						const stu = {
							id: 4,
							name: "赵六",
							age: 60
						}
						this.stus.unshift(stu);
					}
				}
			})
		</script>
	</body>
</html>
